#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>
#include <QDebug>
#include <QMessageBox>
//数据库头文件
#include <QSqlDatabase>
#include <QSqlQuery>
#include <QSqlError>

//登录界面头文件
#include "admin.h"

//TCP头文件
#include "QTcpSocket"

//页面头文件
#include "homepage.h"
#include "userpage.h"
#include "stallpage.h"
#include "accespage.h"
#include "carpage.h"

#include "carnum.h"

//传输数据结构体
struct get_information{
    char temperature[1024];
    char humidity[1024];
    char MQ_2[1024];
};


QT_BEGIN_NAMESPACE
namespace Ui { class Widget; }
QT_END_NAMESPACE

class Widget : public QWidget
{
    Q_OBJECT

public:
    Widget(QWidget *parent = nullptr);
    ~Widget();

public:
    void sqlite_init();
    void page_init();
    void sentMsgs();
public slots:
    void recvMsg(const QString &text);
    void sentMsg(double fee);
    void socket_data_accept();
    void printf_msg();

private slots:
    void on_btn_home_clicked();

    void on_btn_user_clicked();

    void on_btn_stall_clicked();

    void on_btn_access_clicked();

    void on_btn_car_clicked();

    void get_datas();
    void get_image(QImage image);
    void Car_Num(QString num);




private:
    Ui::Widget *ui;

    class homepage  *u_homepage;
    class userpage  *u_userpage;
    class stallpage *u_stallpage;
    class carpage   *u_carpage;
    class accespage *u_accespage;


    QString loginMsg;
    QTcpSocket *socket_data;

    QTcpSocket *socket_send_data;
    struct get_information information;
    int flag;

    QImage image;
    Carnum *get_car_num;

};
#endif // WIDGET_H
